package com.niit.web.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/CheckCodeController")
public class CheckCodeControoler extends HttpServlet {
	private static final long serialVersionUID = 1L;

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String code = request.getParameter("code");
		String sessionCode = (String) request.getSession().getAttribute("code");
		if(sessionCode!=null&&sessionCode.equals(code)){
			//验证成功
			response.getOutputStream().write("1".getBytes());
		}else{
			//验证失败
			response.getOutputStream().write("0".getBytes());
		}
	}

}
